package Demo1;

public class T12 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println("线程运行中");
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        //        此处打印结果为 NEW
        System.out.println(thread.getState());
        thread.start();
        Thread.sleep(500);
        System.out.println(thread.getState());
        thread.join();
//        此处状态为 TERMINATED
        System.out.println(thread.getState());
    }
}
